﻿package net.yogadigital.popit.utils 
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import net.yogadigital.popit.events.PopitEvent;
	
	/**
	 * ...
	 * @author Juanda
	 */
	public class DragArea extends Sprite
	{
		public function DragArea() 
		{
			this.buttonMode = true;
			this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown, false, 0, true);
			this.addEventListener(MouseEvent.MOUSE_UP, onMouseUp, false, 0, true);
		}
		
		private function onMouseDown(e:MouseEvent):void 
		{
			dispatchEvent(new PopitEvent(PopitEvent.START_DRAG, true, false));
		}
		
		private function onMouseUp(e:MouseEvent):void 
		{
			dispatchEvent(new PopitEvent(PopitEvent.STOP_DRAG, true, false));
		}
	}
}